package com.zq.behavior.state;

public interface State {
    // 挂挡
    void pull(Car car);
}

// 空挡
class Off implements State {

    @Override
    public void pull(Car car) {
        // 当空挡pull后变成抵挡
        car.setState(new Low());
    }
}

// 低挡
class Low implements State {

    @Override
    public void pull(Car car) {
        // 当低挡pull后变成中挡
        car.setState(new Medium());
    }
}

// 中挡
class Medium implements State {

    @Override
    public void pull(Car car) {
        // 当中挡pull后变成高挡
        car.setState(new High());
    }
}

// 高挡
class High implements State {

    @Override
    public void pull(Car car) {
        // 当高挡pull后变成空挡
        car.setState(new Off());
    }
}